package com.core.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.core.base.dao.BaseHibernateDao;
import com.core.model.CountryRegion;

/**
 * 国家信息DAO
 * 
 * @author pt-chenqw
 *
 */
@Repository("countryRegionDAO")
public class CountryRegionDAO extends BaseHibernateDao<CountryRegion> {
	
	/**
	 * 查询所有国家列表信息
	 * @return
	 */
	public List<CountryRegion> getAllCountryRegions(){
		String hql = "from CountryRegion where status = 1";
		return findAll(hql);
	}
	
	/**
	 * 根据名称查询列表信息
	 * @param name
	 * @return
	 */
	public List<CountryRegion> getCountryRegionsByName(String name){
		String hql = "from CountryRegion where name like ? and status = 1";
		return find(hql, "%"+name+"%");
	}

}
